cd src/Admin/Admin.BlazorWasmApp;

image_tag=`date +%Y%m%d%H%M%S`;
echo $image_tag;

# build镜像并且打上tag
docker build -t mywasmapp:latest -f Dockerfile ..;
docker images;

# 停止并删除旧版 mywasmapp container
CID=$(docker ps | grep "mywasmapp" | awk '{print $1}')
echo $CID
if [ "$CID" != "" ];then
  docker stop $CID
  docker rm $CID
fi

# 把刚刚build出来的镜像跑起来
docker run -p 5001:80 --name mywasmapp -d mywasmapp:latest;
docker ps -a;
docker logs mywasmapp;